<template>
  <div style="width:100%;height:100%; padding: 0 20px;">
    <div style="width:100%;height:10%;">
      <div class="warnTitle">{{ seeNoticeItem.warnTitle }}</div>
      <div class="createDatetime">发文日期：{{ seeNoticeItem.createDatetime }}</div>
    </div>
    <div
      style="width:100%;height:80%;"
      class="borderContent"
      v-html="seeNoticeItem.contentString" />
    <div style="width:100%;height:10%;" class="noticeBottom">
      <div>
        <div
          v-for="(item,index) in seeNoticeItem.imagesList"
          :key="index"
          style="cursor: pointer;">
          {{ item.fileName }}
          <span
            style="margin-left:10px;color:#66ffff"
            @click="download(item)">下载</span>
        </div>
      </div>
      <div style="display:flex;">
        <div
          v-if="isPrevious()"
          style="margin-right:10px;color:#fff;  cursor: pointer;"
          @click="previous">上一条</div>
        <div v-if="isNext()" style="color:#fff;  cursor: pointer;" @click="next">下一条</div>
      </div>
    </div>
  </div>
</template>
<script>
import { downloadFile } from '@/utils/public'
export default {
  props: {
    seeNoticeDate: {
      type: Array,
      default: () => []
    },
    seeNoticeItem: {
      type: Object,
      default: () => { }
    },
    seeNoticeIndex: {
      type: Number,
      default: () => 0
    }
  },
  data() {

  },
  methods: {
    isPrevious() {
      return !!this.seeNoticeDate[this.seeNoticeIndex - 1]
    },
    isNext() {
      return !!this.seeNoticeDate[this.seeNoticeIndex + 1]
    },
    previous() {
      this.$emit('seeNotice', {
        item: this.seeNoticeDate[this.seeNoticeIndex - 1],
        data: this.seeNoticeDate,
        index: this.seeNoticeIndex - 1
      })
    },
    next() {
      this.$emit('seeNotice', {
        item: this.seeNoticeDate[this.seeNoticeIndex + 1],
        data: this.seeNoticeDate,
        index: this.seeNoticeIndex + 1
      })
    },
    download(item) {
      downloadFile({ url: item.filePath, fileName: item.fileName })
    }
  }
}
</script>
<style scoped>
.borderContent {
    border: 1px solid #38499b;
    border-radius: 1%;
    padding: 15px;
    color: rgba(255, 255, 255, 0.8);
}
.warnTitle {
    text-align: center;
    font-size: 28px;
    color: #fff;
}
.createDatetime {
    text-align: center;
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
    line-height: 20px;
}
.noticeBottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.6);
}
</style>
